namespace MultiplayerServerDiscoveryHandlers
{
	public class DiscoveryHandler : MessageHandler
	{
		public override bool CanAcceptMessage(UDPMessageBase message)
		{
			return message.type == UDPMessageBase.MessageType.ServerDiscoveryMessage && base.CanAcceptMessage(message);
		}

		public override void OnMessageReceived(UDPMessageBase message)
		{
			IntroductionMessage introductionMessage = new IntroductionMessage();
			server.SendMessage(message.senderAddress, message.senderPort, introductionMessage.SerializeToBytes());
		}
	}
}
